package file;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        File dir = new File("./src");
        if(dir.isDirectory()){
            File [] subs=dir.listFiles();//当前目录所有子项


            System.out.println("总共有"+subs.length+"个元素（子项）");
            for(File sub:subs){
                System.out.println(sub.getName());
            }
        }


    }
}
